<?php
include("./config.php");
include("./utils.php");

$op=$_POST['op'];
$mail=$_POST['mail'];
$passwd=$_POST['passwd'];
$ref_url=$_POST['req-url'];

$userid = $mail;

$name=getPOST('name');


function login($userid, $passwd){
    $url = 'http://ankiang.sinaapp.com/account-data.php';
    $post_data['op'] = 'log';
    $post_data['mail'] = $userid;
    $post_data['passwd'] = $passwd;
    $res = sendpost($url, $post_data);
    return $res;
}

if ($op == 'log'){
  $json = login($userid, $passwd);
  if (strpos($json, '}') == false){
    echo "{code:0x1001, msg:'账号或密码错误'}";
  } else {
  //  setcookie("userid", $json, time()+3600*24*7);  
    echo $json;
  }

}else if ($op == 'reg'){
}

?>

